package com.project.rfidpage.controller;


import com.project.rfidpage.aop.TagLog;
import com.project.rfidpage.dto.SearchByMonthParam;
import com.project.rfidpage.dto.SearchByRqParam;
import com.project.rfidpage.service.CenterLinkService;
import com.project.rfidpage.util.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/rfidpage/centerlink/")
public class CenterLinkController extends BaseController {

    @Resource
    CenterLinkService centerLinkService;

    /**
     * 查询数据中心链路检测
     */
    @PostMapping("page")
    @TagLog(operation = 0, content = "查询数据中心链路检测")
    public RestResult page() {
        return RestResult.ok(centerLinkService.getForPage());
    }

    /**
     * 查询数据中心链路检测详细
     */
    @PostMapping("detail")
    @TagLog(operation = 0, content = "查询数据中心链路检测详细")
    public RestResult detail() {
        return RestResult.ok(centerLinkService.getDetailForPage());
    }

    /**
     * 查询数据分发链路检测
     */
    @PostMapping("datashare/page")
    @TagLog(operation = 0, content = "查询数据分发链路检测")
    public RestResult dataSharePage() {
        return RestResult.ok(centerLinkService.getDataShareForPage());
    }

    /**
     * 查询数据通信质量按月份报告
     */
    @PostMapping("monthly/page")
    @TagLog(operation = 0, content = "查询数据通信质量按月份报告")
    public RestResult monthlyPage(@RequestBody SearchByMonthParam param) {
        this.getPage(false, param);
        return RestResult.ok(centerLinkService.getListByMonthForPage(param));
    }

    /**
     * 查询数据通信质量按日期报告
     */
    @PostMapping("daily/page")
    @TagLog(operation = 0, content = "查询数据通信质量按日期报告")
    public RestResult dailyPage(@RequestBody SearchByRqParam param) {
        this.getPage(false, param);
        return RestResult.ok(centerLinkService.getListByRqForPage(param));
    }
}
